package dao.impl;

import dao.UserDao;
import mapper.UserMapper;
import org.apache.ibatis.session.SqlSession;
import pojo.User;
import util.MybatisUtil;

public class UserDaoImpl implements UserDao {
    private static SqlSession session = null;
    @Override
    public User login(String username, String password) {
        User user=null;
        try {
            session = MybatisUtil.createSqlSession();
            user = session.getMapper(UserMapper.class).login(username,password);
            return user;
        }finally {
            session.close();
        }
    }
}
